/*
 * @Author: duanguang
 * @Date: 2020-06-04 15:37:47
 * @LastEditTime: 2021-10-28 23:02:03
 * @LastEditors: duanguang
 * @Description: 
 * @FilePath: /legions-server/app/controller/home.ts
 * 「扫去窗上的尘埃，才可以看到窗外的美景。」
 */
import { Controller } from 'egg';
import { HttpClientResponse } from 'urllib';
export default class HomeController extends Controller {
  public async index() {
    const { ctx } = this;
    ctx.body = await ctx.service.test.sayHi('egg');
  }
  public async readHtmlString() {
    const { ctx } = this;
    const { target } = this.ctx.query;
    const result = await this.ctx.curl<HttpClientResponse<string>>(target, {
      dataType: 'text',
    });
    ctx.body = result.data.toString();
    ctx.response.body = result.data.toString();
  }
}
